% s,over

Although there are numerous options
in the \irt,
most image reconstruction examples
in the toolbox
have the following outline.
A concrete example
is \ty{example/recon_limited_angle1.m}.

\blist
\item
Pick an image size
and generate a ``true'' digital phantom image
such as the Shepp-Logan phantom.
\item
Generate a system matrix
(usually called \ty{G}),
typically a \fatrix object (see below),
that will be used for iterative reconstruction.
\item
Generate simulated measurements \ty{y},
possibly using the \fatrix object
or possibly using an analytical model
(\eg, the line-integrals through the phantom).
(Using the \fatrix object
is cheating because in the real world
there is model mismatch that contaminates the measurements.)
\item
Perform a conventional non-iterative reconstruction method
(\eg, \ty{fbp2})
to get a baseline image for comparison.
\item
Generate a regularization object
(usually \ty{R}).
\item
Check the predicted resolution properties
of that \ty{R}
using \ty{qpwls_psf},
and adjust the regularization parameter \bet
if necessary.
\item
Apply an iterative algorithm
to the data \ty{y}
using the system model \ty{G} and the regularizer \ty{R}
for some user-specified number of iterations.
\elist


\subsection{Getting started}

The best way to learn
is probably to run an example file
like
\ty{recon_limited_angle1.m},
possibly
inserting \ty{keyboard} commands
within the m-file
to examine the variables.
Most of \irt routines
have a built-in help message;
\eg,
typing \ty{im}
without any arguments
will return usage information.
Many \irt routines
have a built-in test routine,
\eg,
\ty{ellipse_sino test}
runs a built-in test
of the routine for generating
the sinogram of ellipse objects.


\subsection{Masking}

One subtle point is that we usually display images
as a rectangular grid of $\ty{nx} \times \ty{ny}$ pixels,
but the iterative algorithms
work on column vectors.
Often only a subset of the pixels are updated.
A logical array called the \ty{mask}
specifies which pixels are to be updated.
The function call
\ty{x_col = x_array(mask(:))}
extracts the relevant pixel elements
``within the mask''
into a column vector.
Conversely, the call
\ty{x_array = embed(x_col, mask)}
puts the elements of the column vector
back into the appropriate places
in the array.

